<?php

use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

use \App\Person;

class PersonSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        //
        //DB::table('persons')->delete();

        $reg_addr = [
            '天津市,天津市市辖区,和平区',
            '福建省,福州市,鼓楼区',
            '河南省,郑州市,中原区',
            '河南省,信阳市,浉河区',
            '浙江省,杭州市,上城区',
            '北京市,北京市市辖区,东城区',
            '山西省,太原市,小店区',
            '内蒙古自治区,呼和浩特市,新城区',
            '辽宁省,沈阳市,和平区',
            '吉林省,长春市,南关区',
            '上海市,上海市市辖区,黄浦区',
            '福建省,福州市,鼓楼区',
            '河南省,郑州市,中原区',
            '湖南省,长沙市,芙蓉区',
            '宁夏回族自治区,银川市,兴庆区',
            '台湾省,台北市,',
            '宁夏回族自治区,银川市,兴庆区',
            '四川省,成都市,新津县',
            '四川省,巴中市,巴州区',
            '宁夏回族自治区,银川市,兴庆区',
            '吉林省,长春市,南关区',
            '甘肃省,兰州市,城关区',
        ];

        for ($i=0; $i < 100000; $i++) {
            $addr = array_rand($reg_addr);
            $addr2 = array_rand($reg_addr);

            DB::table('persons')->insert([
                'name'   => "人员" . rand(10000, 99999),
                'avatar'    => "",
                'id_number' => rand(230221199412221464,530623197903099383),
                'reg_addr' => $reg_addr[$addr],
                'temp_addr' => $reg_addr[$addr2],
                'five_saw_time' => rand(strtotime('2010-1-1'), strtotime('2018-12-31')),
                'leave_time' => '',
                'meet_situation' => "见面情况",
                'remark' => "我市活动情况",
                'is_the_city' => "1",
                'phone' => "17035022222",
                'qq' => "123456" ,
                'weixin' => "hellome",
                'user_id' => 1,
                'created_at' => date('Y-m-d H:i:s'),
                'updated_at' => date('Y-m-d H:i:s'),
                'is_deleted' => 0,
                //'time_archive' => ''
            ]);
        }
    }
}
